package com.xmy.cultivate.schedule;

import com.xmy.cultivate.service.IMqSchedulingLogService;
import com.xmy.cultivate.service.IRecordCourseService;
import com.xmy.cultivate.service.IWecharPushService;
import com.xmy.cultivate.util.SpringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Date;

/**
 * 微信上课提醒推送【延迟消息推送,上课前2个小时，与上课前30分钟】
 */
public class WxRemindMqJob implements Job {

    @Autowired
    IMqSchedulingLogService iMqSchedulingLogService = SpringUtils.getBean(IMqSchedulingLogService.class);

    private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    private void before() {
        //System.out.println("任务WxRemindJob：开始执行-" + dateFormat.format(new Date()));
    }

    @Override
    public void execute(JobExecutionContext arg0) throws JobExecutionException {
        before();
        //System.out.println("任务WxRemindJob：业务逻辑。。。");
        //iRecordCourseService = (IRecordCourseService) SpringContextJobUtil.getBean("iRecordCourseService");
        LocalDate dateNow = LocalDate.now();
        String lessonType = "1";
        iMqSchedulingLogService.addData(null,null,dateNow.toString(),null,null,lessonType);
        after();
    }

    private void after() {
        //System.out.println("任务WxRemindJob：执行结束");
        //System.out.println();
    }
}
